var layer = layui.layer
    ,table = layui.table
    ,$ = layui.jquery
    ,processKey=getQueryVariable("processKey")

;
 table.render({
    elem: '#characterid'
    //,data:data1
     ,where:{
        "processKey":processKey
     }
     ,typ:"get"
    ,url:"process/queryToDoTasks"
    ,toolbar: '#toolbarDemo'
    ,cols: [[
        //{checkbox: true, width:50, fixed: true}
        {field:'processDfName', title:'流程名称', fixed: true,width:200}
        ,{field:'name', title:'当前节点', fixed: true ,width:200}
        ,{field:'createtime', title:'流程发起时间', fixed: true,width:200}
        ,{fixed: 'right',  align:'left', toolbar: '#charactereditor', title:'操作'}
    ]]
    ,id: 'charactertableid'
    ,height: $(document).height() - $('#characterid').offset().top - 50
    ,page: false
    ,done:function(res, curr, count){
       /* $("[data-field = 'type']").children().each(function(){
            if($(this).text() == '1'){
                $(this).text("资源");
            }else if($(this).text() == '2'){
                $(this).text("标签");
            }
        })*/

    }
});


//监听工具条
table.on('tool(charactertable)', function(obj){
    var processId=obj.data.processInstanceId;
    var taskId=obj.data.taskid;
    getBusskey(processId,taskId);
});
function getBusskey(processId,taskId) {
    var busskey="";
    var formkey="";
    $.ajax({
        type : 'get',
        //  url : 'resource/getTree',
        data: {"taskId":taskId},
        url:'process/getFormInfo',
        dataType:"json",
        // contentType: 'application/json',
        async:false,
        success : function (da) {
            if(da.status==200 ){
                busskey=da.data.businesskey;
                formkey=da.data.formkey;
            }
        },
        error: function(data) {
            // layer.msg("获取失败!");
        }
    });
    parent.intab("views/jsp/SystemCenter/sp.jsp?processId="+processId+"&busskey="+busskey+"&formkey="+formkey+"&taskId="+taskId,"流程处理");
}

